/**
 * description:webpack dll
 * author:
 * date:2020/04/01
 * */

const DllPlugin = require('webpack/lib/DllPlugin');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const config = require("./config");

module.exports = {
    context: __dirname,
    entry: {
        vueFamily: ['vue/dist/vue.esm.js', 'vue', 'vue-router', 'axios', 'vuex']
    },
    output: {
        filename: `[name].dll.js`,
        path: config.dllDir,
        library: '_dll_[name]',  //dll的全局变量名
    },
    plugins: [
        new CleanWebpackPlugin(), // 默认清空我们output里面设置的所有文件夹
        new DllPlugin({
            context: __dirname,
            name: '_dll_[name]',  //[name].manifest.json的name值，与library名字一致
            path: `${config.dllDir}/[name].${config.dllJsonSuffix}`//描述生成的manifest文件
        })
    ]
};
